package com.ymm.platform.api.utils;



import lombok.extern.slf4j.Slf4j;

/**
 * @Company: CUG
 * @Description: TODO
 * @Author: chencong
 * @Date: 2022-08-15 11:03
 **/
@Slf4j
public class JudgePagination {
    public Result judgePaginationPlausibility(Integer pageNum, Integer pageSize){
        if (pageNum == null) {
            log.warn("pageNum为null");
            return Result.fail(null, ResultCodeEnum.PARAM_ERROR);
        }
        if(pageSize == null || pageSize>1000){
            log.warn("pageSize为null或者pizeSize过大");
            return Result.fail(null, ResultCodeEnum.PARAM_ERROR);
        }
        if (pageNum >156||pageSize>1000) {
            log.warn("pageNum过大或者pizeSize过大");
            return Result.fail(null, ResultCodeEnum.PARAM_ERROR);
        }
        return Result.success();
    }
}
